package com.mz.mattress.admin.service.impl;

import com.mz.mattress.admin.mapper.SysDictItemMapper;
import com.mz.mattress.admin.service.SysDictItemService;
import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.entity.SysDictItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

@Service
public class SysDictItemServiceImpl implements SysDictItemService {

    @Autowired
    private SysDictItemMapper sysDictItemMapper;

    @Override
    public Result<List<SysDictItem>> list(Integer pid) {
        List<SysDictItem> list = sysDictItemMapper.selectByPid(pid);
        return Result.ok(list);
    }

    @Override
    public Result add(SysDictItem item) {
        sysDictItemMapper.insert(item);
        return Result.ok();
    }

    @Override
    public Result updateById(SysDictItem item) {
        sysDictItemMapper.updateById(item);
        return Result.ok();
    }

    @Override
    public Result deleteByIds(Set<Integer> ids) {
        sysDictItemMapper.deleteBatchIds(ids);
        return Result.ok();
    }

}
